/* rfc1907.c - IDB+ Module source for rfc1907.mi2. */

/* Copyright 2003-2005 Neotune Information Technology Co., Ltd. */

/*
DESCRIPTION
This module defines the IDB+ structures and IDB+ Object handler routines to
access the IDB+ objects defined in rfc1907.mi2.

INCLUDES: 
rfc1907.h
*/

/* Includes */
#include "neos_vx_win.h"
#include "idbLib.h"
#include "rfc1907.h"

/* %%BeginUserCode rfc1907_IncludeFiles */

#include "snmpUtil.h"
#include "v2_sys.h"
//#include "configNeos.h"
#include "snmpstat.h"
//#include "v2mt_sys.h"

/* %%EndUserCode   rfc1907_IncludeFiles */

/* Defines */
/* %%BeginUserCode rfc1907_Defines */
/* %%EndUserCode   rfc1907_Defines */

/* Globals */
/* %%BeginUserCode rfc1907_Globals */
/* %%EndUserCode   rfc1907_Globals */

/* Locals */
LOCAL char * moduleName = "rfc1907";
/* %%BeginUserCode rfc1907_Locals */

/* %%EndUserCode   rfc1907_Locals */

/* Prototypes */
LOCAL STATUS rfc1907ScalarHandler ( idbRequest_t request, idb_t * idb );
LOCAL STATUS sysOREntryTableHandler ( idbRequest_t request, idb_t * idb );

/* %%BeginUserCode rfc1907_Prototypes */
/* %%EndUserCode   rfc1907_Prototypes */


/****************************************************************************
* IDB+ Module Object Descriptors
*/

LOCAL idbObjDesc_t sysDescr_objDesc[] = {
  { sysDescr, 1, 255, /* localId=0  1.3.6.1.2.1.1.1 */
    { 0, 0 }, IDB_OCTET_STRING, IDB_READ,
    (IDB_VALID|IDB_ISDISPLAY), rfc1907ScalarHandler,
    (char *)0, "rfc1907:sysDescr" },
  { 0 }
};

LOCAL idbObjDesc_t sysObjectID_objDesc[] = {
  { sysObjectID, 2, 64, /* localId=1  1.3.6.1.2.1.1.2 */
    { 0, 0 }, IDB_OBJECT_IDENTIFIER, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:sysObjectID" },
  { 0 }
};

LOCAL idbObjDesc_t sysUpTime_objDesc[] = {
  { sysUpTime, 3, 4, /* localId=2  1.3.6.1.2.1.1.3 */
    { 0, 0 }, IDB_TimeTicks, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:sysUpTime" },
  { 0 }
};

LOCAL idbObjDesc_t sysContact_objDesc[] = {
  { sysContact, 4, 255, /* localId=3  1.3.6.1.2.1.1.4 */
    { 0, 0 }, IDB_OCTET_STRING, (IDB_READ|IDB_WRITE),
    (IDB_VALID|IDB_ISDISPLAY), rfc1907ScalarHandler,
    (char *)0, "rfc1907:sysContact" },
  { 0 }
};

LOCAL idbObjDesc_t sysName_objDesc[] = {
  { sysName, 5, 255, /* localId=4  1.3.6.1.2.1.1.5 */
    { 0, 0 }, IDB_OCTET_STRING, (IDB_READ|IDB_WRITE),
    (IDB_VALID|IDB_ISDISPLAY), rfc1907ScalarHandler,
    (char *)0, "rfc1907:sysName" },
  { 0 }
};

LOCAL idbObjDesc_t sysLocation_objDesc[] = {
  { sysLocation, 6, 255, /* localId=5  1.3.6.1.2.1.1.6 */
    { 0, 0 }, IDB_OCTET_STRING, (IDB_READ|IDB_WRITE),
    (IDB_VALID|IDB_ISDISPLAY), rfc1907ScalarHandler,
    (char *)0, "rfc1907:sysLocation" },
  { 0 }
};

LOCAL idbObjDesc_t sysServices_objDesc[] = {
  { sysServices, 7, 4, /* localId=6  1.3.6.1.2.1.1.7 */
    { 0, 127 }, IDB_INTEGER, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:sysServices" },
  { 0 }
};

LOCAL idbObjDesc_t sysORLastChange_objDesc[] = {
  { sysORLastChange, 8, 4, /* localId=7  1.3.6.1.2.1.1.8 */
    { 0, 0 }, IDB_TimeTicks, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:sysORLastChange" },
  { 0 }
};

LOCAL idbObjDesc_t sysOREntry_objDesc[] = {
  { sysORIndex, 1, 4, /* localId=8  1.3.6.1.2.1.1.9.1.1 */
    { 1, 2147483647 }, IDB_INTEGER, IDB_NOT_ACCESSIBLE,
    (IDB_VALID|IDB_INDEX), sysOREntryTableHandler,
    (char *)0, "rfc1907:sysORIndex" },
  { sysORID, 2, 64, /* localId=9  1.3.6.1.2.1.1.9.1.2 */
    { 0, 0 }, IDB_OBJECT_IDENTIFIER, IDB_READ,
    (IDB_VALID), sysOREntryTableHandler,
    (char *)0, "rfc1907:sysORID" },
  { sysORDescr, 3, 255, /* localId=10  1.3.6.1.2.1.1.9.1.3 */
    { 0, 0 }, IDB_OCTET_STRING, IDB_READ,
    (IDB_VALID|IDB_ISDISPLAY), sysOREntryTableHandler,
    (char *)0, "rfc1907:sysORDescr" },
  { sysORUpTime, 4, 4, /* localId=11  1.3.6.1.2.1.1.9.1.4 */
    { 0, 0 }, IDB_TimeTicks, IDB_READ,
    (IDB_VALID), sysOREntryTableHandler,
    (char *)0, "rfc1907:sysORUpTime" },
  { 0 }
};

LOCAL idbObjDesc_t snmpInPkts_objDesc[] = {
  { snmpInPkts, 1, 4, /* localId=12  1.3.6.1.2.1.11.1 */
    { 0, 0 }, IDB_Counter32, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpInPkts" },
  { 0 }
};

LOCAL idbObjDesc_t snmpOutPkts_objDesc[] = {
  { snmpOutPkts, 2, 4, /* localId=13  1.3.6.1.2.1.11.2 */
    { 0, 0 }, IDB_Counter32, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpOutPkts" },
  { 0 }
};

LOCAL idbObjDesc_t snmpInBadVersions_objDesc[] = {
  { snmpInBadVersions, 3, 4, /* localId=14  1.3.6.1.2.1.11.3 */
    { 0, 0 }, IDB_Counter32, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpInBadVersions" },
  { 0 }
};

LOCAL idbObjDesc_t snmpInBadCommunityNames_objDesc[] = {
  { snmpInBadCommunityNames, 4, 4, /* localId=15  1.3.6.1.2.1.11.4 */
    { 0, 0 }, IDB_Counter32, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpInBadCommunityNames" },
  { 0 }
};

LOCAL idbObjDesc_t snmpInBadCommunityUses_objDesc[] = {
  { snmpInBadCommunityUses, 5, 4, /* localId=16  1.3.6.1.2.1.11.5 */
    { 0, 0 }, IDB_Counter32, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpInBadCommunityUses" },
  { 0 }
};

LOCAL idbObjDesc_t snmpInASNParseErrs_objDesc[] = {
  { snmpInASNParseErrs, 6, 4, /* localId=17  1.3.6.1.2.1.11.6 */
    { 0, 0 }, IDB_Counter32, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpInASNParseErrs" },
  { 0 }
};

LOCAL idbObjDesc_t snmpInTooBigs_objDesc[] = {
  { snmpInTooBigs, 8, 4, /* localId=18  1.3.6.1.2.1.11.8 */
    { 0, 0 }, IDB_Counter32, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpInTooBigs" },
  { 0 }
};

LOCAL idbObjDesc_t snmpInNoSuchNames_objDesc[] = {
  { snmpInNoSuchNames, 9, 4, /* localId=19  1.3.6.1.2.1.11.9 */
    { 0, 0 }, IDB_Counter32, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpInNoSuchNames" },
  { 0 }
};

LOCAL idbObjDesc_t snmpInBadValues_objDesc[] = {
  { snmpInBadValues, 10, 4, /* localId=20  1.3.6.1.2.1.11.10 */
    { 0, 0 }, IDB_Counter32, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpInBadValues" },
  { 0 }
};

LOCAL idbObjDesc_t snmpInReadOnlys_objDesc[] = {
  { snmpInReadOnlys, 11, 4, /* localId=21  1.3.6.1.2.1.11.11 */
    { 0, 0 }, IDB_Counter32, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpInReadOnlys" },
  { 0 }
};

LOCAL idbObjDesc_t snmpInGenErrs_objDesc[] = {
  { snmpInGenErrs, 12, 4, /* localId=22  1.3.6.1.2.1.11.12 */
    { 0, 0 }, IDB_Counter32, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpInGenErrs" },
  { 0 }
};

LOCAL idbObjDesc_t snmpInTotalReqVars_objDesc[] = {
  { snmpInTotalReqVars, 13, 4, /* localId=23  1.3.6.1.2.1.11.13 */
    { 0, 0 }, IDB_Counter32, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpInTotalReqVars" },
  { 0 }
};

LOCAL idbObjDesc_t snmpInTotalSetVars_objDesc[] = {
  { snmpInTotalSetVars, 14, 4, /* localId=24  1.3.6.1.2.1.11.14 */
    { 0, 0 }, IDB_Counter32, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpInTotalSetVars" },
  { 0 }
};

LOCAL idbObjDesc_t snmpInGetRequests_objDesc[] = {
  { snmpInGetRequests, 15, 4, /* localId=25  1.3.6.1.2.1.11.15 */
    { 0, 0 }, IDB_Counter32, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpInGetRequests" },
  { 0 }
};

LOCAL idbObjDesc_t snmpInGetNexts_objDesc[] = {
  { snmpInGetNexts, 16, 4, /* localId=26  1.3.6.1.2.1.11.16 */
    { 0, 0 }, IDB_Counter32, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpInGetNexts" },
  { 0 }
};

LOCAL idbObjDesc_t snmpInSetRequests_objDesc[] = {
  { snmpInSetRequests, 17, 4, /* localId=27  1.3.6.1.2.1.11.17 */
    { 0, 0 }, IDB_Counter32, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpInSetRequests" },
  { 0 }
};

LOCAL idbObjDesc_t snmpInGetResponses_objDesc[] = {
  { snmpInGetResponses, 18, 4, /* localId=28  1.3.6.1.2.1.11.18 */
    { 0, 0 }, IDB_Counter32, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpInGetResponses" },
  { 0 }
};

LOCAL idbObjDesc_t snmpInTraps_objDesc[] = {
  { snmpInTraps, 19, 4, /* localId=29  1.3.6.1.2.1.11.19 */
    { 0, 0 }, IDB_Counter32, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpInTraps" },
  { 0 }
};

LOCAL idbObjDesc_t snmpOutTooBigs_objDesc[] = {
  { snmpOutTooBigs, 20, 4, /* localId=30  1.3.6.1.2.1.11.20 */
    { 0, 0 }, IDB_Counter32, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpOutTooBigs" },
  { 0 }
};

LOCAL idbObjDesc_t snmpOutNoSuchNames_objDesc[] = {
  { snmpOutNoSuchNames, 21, 4, /* localId=31  1.3.6.1.2.1.11.21 */
    { 0, 0 }, IDB_Counter32, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpOutNoSuchNames" },
  { 0 }
};

LOCAL idbObjDesc_t snmpOutBadValues_objDesc[] = {
  { snmpOutBadValues, 22, 4, /* localId=32  1.3.6.1.2.1.11.22 */
    { 0, 0 }, IDB_Counter32, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpOutBadValues" },
  { 0 }
};

LOCAL idbObjDesc_t snmpOutGenErrs_objDesc[] = {
  { snmpOutGenErrs, 24, 4, /* localId=33  1.3.6.1.2.1.11.24 */
    { 0, 0 }, IDB_Counter32, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpOutGenErrs" },
  { 0 }
};

LOCAL idbObjDesc_t snmpOutGetRequests_objDesc[] = {
  { snmpOutGetRequests, 25, 4, /* localId=34  1.3.6.1.2.1.11.25 */
    { 0, 0 }, IDB_Counter32, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpOutGetRequests" },
  { 0 }
};

LOCAL idbObjDesc_t snmpOutGetNexts_objDesc[] = {
  { snmpOutGetNexts, 26, 4, /* localId=35  1.3.6.1.2.1.11.26 */
    { 0, 0 }, IDB_Counter32, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpOutGetNexts" },
  { 0 }
};

LOCAL idbObjDesc_t snmpOutSetRequests_objDesc[] = {
  { snmpOutSetRequests, 27, 4, /* localId=36  1.3.6.1.2.1.11.27 */
    { 0, 0 }, IDB_Counter32, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpOutSetRequests" },
  { 0 }
};

LOCAL idbObjDesc_t snmpOutGetResponses_objDesc[] = {
  { snmpOutGetResponses, 28, 4, /* localId=37  1.3.6.1.2.1.11.28 */
    { 0, 0 }, IDB_Counter32, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpOutGetResponses" },
  { 0 }
};

LOCAL idbObjDesc_t snmpOutTraps_objDesc[] = {
  { snmpOutTraps, 29, 4, /* localId=38  1.3.6.1.2.1.11.29 */
    { 0, 0 }, IDB_Counter32, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpOutTraps" },
  { 0 }
};

LOCAL idbObjDesc_t snmpEnableAuthenTraps_objDesc[] = {
  { snmpEnableAuthenTraps, 30, 4, /* localId=39  1.3.6.1.2.1.11.30 */
    { 1, 2 }, IDB_INTEGER, (IDB_READ|IDB_WRITE),
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpEnableAuthenTraps" },
  { 0 }
};

LOCAL idbObjDesc_t snmpSilentDrops_objDesc[] = {
  { snmpSilentDrops, 31, 4, /* localId=40  1.3.6.1.2.1.11.31 */
    { 0, 0 }, IDB_Counter32, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpSilentDrops" },
  { 0 }
};

LOCAL idbObjDesc_t snmpProxyDrops_objDesc[] = {
  { snmpProxyDrops, 32, 4, /* localId=41  1.3.6.1.2.1.11.32 */
    { 0, 0 }, IDB_Counter32, IDB_READ,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpProxyDrops" },
  { 0 }
};

LOCAL idbObjDesc_t snmpTrapOID_objDesc[] = {
  { snmpTrapOID, 1, 64, /* localId=42  1.3.6.1.6.3.1.1.4.1 */
    { 0, 0 }, IDB_OBJECT_IDENTIFIER, IDB_NOT_ACCESSIBLE,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpTrapOID" },
  { 0 }
};

LOCAL idbObjDesc_t snmpTrapEnterprise_objDesc[] = {
  { snmpTrapEnterprise, 3, 64, /* localId=43  1.3.6.1.6.3.1.1.4.3 */
    { 0, 0 }, IDB_OBJECT_IDENTIFIER, IDB_NOT_ACCESSIBLE,
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpTrapEnterprise" },
  { 0 }
};

LOCAL idbObjDesc_t snmpSetSerialNo_objDesc[] = {
  { snmpSetSerialNo, 1, 4, /* localId=44  1.3.6.1.6.3.1.1.6.1 */
    { 0, 0 }, IDB_INTEGER, (IDB_READ|IDB_WRITE),
    (IDB_VALID), rfc1907ScalarHandler,
    (char *)0, "rfc1907:snmpSetSerialNo" },
  { 0 }
};

/*****************************************************************************
* IDB+ Module OID Table
*
* The OID list below (e.g.,{1,3,6,1, ...}) is the OID prefix minus the
* last sub-identifier.  The last sub-identifier is found in the
* object descriptor idbObjDesc_t structure.
*/

LOCAL idbOidTable_t oidTable[] = {
  /*   0: Scalar Object -- sysDescr */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,1}, 8,   /*lint !e785 */
    0, 1, { 0 },
    sysDescr_objDesc },

  /*   1: Scalar Object -- sysObjectID */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,1}, 8,   /*lint !e785 */
    0, 1, { 0 },
    sysObjectID_objDesc },

  /*   2: Scalar Object -- sysUpTime */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,1}, 8,   /*lint !e785 */
    0, 1, { 0 },
    sysUpTime_objDesc },

  /*   3: Scalar Object -- sysContact */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,1}, 8,   /*lint !e785 */
    0, 1, { 0 },
    sysContact_objDesc },

  /*   4: Scalar Object -- sysName */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,1}, 8,   /*lint !e785 */
    0, 1, { 0 },
    sysName_objDesc },

  /*   5: Scalar Object -- sysLocation */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,1}, 8,   /*lint !e785 */
    0, 1, { 0 },
    sysLocation_objDesc },

  /*   6: Scalar Object -- sysServices */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,1}, 8,   /*lint !e785 */
    0, 1, { 0 },
    sysServices_objDesc },

  /*   7: Scalar Object -- sysORLastChange */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,1}, 8,   /*lint !e785 */
    0, 1, { 0 },
    sysORLastChange_objDesc },

  /*   8: Table Object -- sysOREntry */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,1,9,1}, 10,   /*lint !e785 */
    1, 1, { "rfc1907:sysORIndex" }, /*lint !e785 */
    sysOREntry_objDesc },

  /*   9: Scalar Object -- snmpInPkts */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,11}, 8,   /*lint !e785 */
    0, 1, { 0 },
    snmpInPkts_objDesc },

  /*  10: Scalar Object -- snmpOutPkts */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,11}, 8,   /*lint !e785 */
    0, 1, { 0 },
    snmpOutPkts_objDesc },

  /*  11: Scalar Object -- snmpInBadVersions */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,11}, 8,   /*lint !e785 */
    0, 1, { 0 },
    snmpInBadVersions_objDesc },

  /*  12: Scalar Object -- snmpInBadCommunityNames */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,11}, 8,   /*lint !e785 */
    0, 1, { 0 },
    snmpInBadCommunityNames_objDesc },

  /*  13: Scalar Object -- snmpInBadCommunityUses */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,11}, 8,   /*lint !e785 */
    0, 1, { 0 },
    snmpInBadCommunityUses_objDesc },

  /*  14: Scalar Object -- snmpInASNParseErrs */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,11}, 8,   /*lint !e785 */
    0, 1, { 0 },
    snmpInASNParseErrs_objDesc },

  /*  15: Scalar Object -- snmpInTooBigs */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,11}, 8,   /*lint !e785 */
    0, 1, { 0 },
    snmpInTooBigs_objDesc },

  /*  16: Scalar Object -- snmpInNoSuchNames */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,11}, 8,   /*lint !e785 */
    0, 1, { 0 },
    snmpInNoSuchNames_objDesc },

  /*  17: Scalar Object -- snmpInBadValues */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,11}, 8,   /*lint !e785 */
    0, 1, { 0 },
    snmpInBadValues_objDesc },

  /*  18: Scalar Object -- snmpInReadOnlys */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,11}, 8,   /*lint !e785 */
    0, 1, { 0 },
    snmpInReadOnlys_objDesc },

  /*  19: Scalar Object -- snmpInGenErrs */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,11}, 8,   /*lint !e785 */
    0, 1, { 0 },
    snmpInGenErrs_objDesc },

  /*  20: Scalar Object -- snmpInTotalReqVars */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,11}, 8,   /*lint !e785 */
    0, 1, { 0 },
    snmpInTotalReqVars_objDesc },

  /*  21: Scalar Object -- snmpInTotalSetVars */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,11}, 8,   /*lint !e785 */
    0, 1, { 0 },
    snmpInTotalSetVars_objDesc },

  /*  22: Scalar Object -- snmpInGetRequests */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,11}, 8,   /*lint !e785 */
    0, 1, { 0 },
    snmpInGetRequests_objDesc },

  /*  23: Scalar Object -- snmpInGetNexts */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,11}, 8,   /*lint !e785 */
    0, 1, { 0 },
    snmpInGetNexts_objDesc },

  /*  24: Scalar Object -- snmpInSetRequests */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,11}, 8,   /*lint !e785 */
    0, 1, { 0 },
    snmpInSetRequests_objDesc },

  /*  25: Scalar Object -- snmpInGetResponses */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,11}, 8,   /*lint !e785 */
    0, 1, { 0 },
    snmpInGetResponses_objDesc },

  /*  26: Scalar Object -- snmpInTraps */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,11}, 8,   /*lint !e785 */
    0, 1, { 0 },
    snmpInTraps_objDesc },

  /*  27: Scalar Object -- snmpOutTooBigs */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,11}, 8,   /*lint !e785 */
    0, 1, { 0 },
    snmpOutTooBigs_objDesc },

  /*  28: Scalar Object -- snmpOutNoSuchNames */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,11}, 8,   /*lint !e785 */
    0, 1, { 0 },
    snmpOutNoSuchNames_objDesc },

  /*  29: Scalar Object -- snmpOutBadValues */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,11}, 8,   /*lint !e785 */
    0, 1, { 0 },
    snmpOutBadValues_objDesc },

  /*  30: Scalar Object -- snmpOutGenErrs */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,11}, 8,   /*lint !e785 */
    0, 1, { 0 },
    snmpOutGenErrs_objDesc },

  /*  31: Scalar Object -- snmpOutGetRequests */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,11}, 8,   /*lint !e785 */
    0, 1, { 0 },
    snmpOutGetRequests_objDesc },

  /*  32: Scalar Object -- snmpOutGetNexts */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,11}, 8,   /*lint !e785 */
    0, 1, { 0 },
    snmpOutGetNexts_objDesc },

  /*  33: Scalar Object -- snmpOutSetRequests */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,11}, 8,   /*lint !e785 */
    0, 1, { 0 },
    snmpOutSetRequests_objDesc },

  /*  34: Scalar Object -- snmpOutGetResponses */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,11}, 8,   /*lint !e785 */
    0, 1, { 0 },
    snmpOutGetResponses_objDesc },

  /*  35: Scalar Object -- snmpOutTraps */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,11}, 8,   /*lint !e785 */
    0, 1, { 0 },
    snmpOutTraps_objDesc },

  /*  36: Scalar Object -- snmpEnableAuthenTraps */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,11}, 8,   /*lint !e785 */
    0, 1, { 0 },
    snmpEnableAuthenTraps_objDesc },

  /*  37: Scalar Object -- snmpSilentDrops */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,11}, 8,   /*lint !e785 */
    0, 1, { 0 },
    snmpSilentDrops_objDesc },

  /*  38: Scalar Object -- snmpProxyDrops */
  { IDB_SNMP_STRUCT, {1,3,6,1,2,1,11}, 8,   /*lint !e785 */
    0, 1, { 0 },
    snmpProxyDrops_objDesc },

  /*  39: Scalar Object -- snmpTrapOID */
  { IDB_SNMP_STRUCT, {1,3,6,1,6,3,1,1,4}, 10,   /*lint !e785 */
    0, 1, { 0 },
    snmpTrapOID_objDesc },

  /*  40: Scalar Object -- snmpTrapEnterprise */
  { IDB_SNMP_STRUCT, {1,3,6,1,6,3,1,1,4}, 10,   /*lint !e785 */
    0, 1, { 0 },
    snmpTrapEnterprise_objDesc },

  /*  41: Scalar Object -- snmpSetSerialNo */
  { IDB_SNMP_STRUCT, {1,3,6,1,6,3,1,1,6}, 10,   /*lint !e785 */
    0, 1, { 0 },
    snmpSetSerialNo_objDesc },

  { IDB_TERMINATOR }
};

/*****************************************************************************
* IDB+ Module Translate Table
*/

LOCAL idbXlateTable_t xlateTable[] = {
    { &oidTable[  0], &sysDescr_objDesc[0] },
    { &oidTable[  1], &sysObjectID_objDesc[0] },
    { &oidTable[  2], &sysUpTime_objDesc[0] },
    { &oidTable[  3], &sysContact_objDesc[0] },
    { &oidTable[  4], &sysName_objDesc[0] },
    { &oidTable[  5], &sysLocation_objDesc[0] },
    { &oidTable[  6], &sysServices_objDesc[0] },
    { &oidTable[  7], &sysORLastChange_objDesc[0] },
    { &oidTable[  8], &sysOREntry_objDesc[0] },
    { &oidTable[  8], &sysOREntry_objDesc[1] },
    { &oidTable[  8], &sysOREntry_objDesc[2] },
    { &oidTable[  8], &sysOREntry_objDesc[3] },
    { &oidTable[  9], &snmpInPkts_objDesc[0] },
    { &oidTable[ 10], &snmpOutPkts_objDesc[0] },
    { &oidTable[ 11], &snmpInBadVersions_objDesc[0] },
    { &oidTable[ 12], &snmpInBadCommunityNames_objDesc[0] },
    { &oidTable[ 13], &snmpInBadCommunityUses_objDesc[0] },
    { &oidTable[ 14], &snmpInASNParseErrs_objDesc[0] },
    { &oidTable[ 15], &snmpInTooBigs_objDesc[0] },
    { &oidTable[ 16], &snmpInNoSuchNames_objDesc[0] },
    { &oidTable[ 17], &snmpInBadValues_objDesc[0] },
    { &oidTable[ 18], &snmpInReadOnlys_objDesc[0] },
    { &oidTable[ 19], &snmpInGenErrs_objDesc[0] },
    { &oidTable[ 20], &snmpInTotalReqVars_objDesc[0] },
    { &oidTable[ 21], &snmpInTotalSetVars_objDesc[0] },
    { &oidTable[ 22], &snmpInGetRequests_objDesc[0] },
    { &oidTable[ 23], &snmpInGetNexts_objDesc[0] },
    { &oidTable[ 24], &snmpInSetRequests_objDesc[0] },
    { &oidTable[ 25], &snmpInGetResponses_objDesc[0] },
    { &oidTable[ 26], &snmpInTraps_objDesc[0] },
    { &oidTable[ 27], &snmpOutTooBigs_objDesc[0] },
    { &oidTable[ 28], &snmpOutNoSuchNames_objDesc[0] },
    { &oidTable[ 29], &snmpOutBadValues_objDesc[0] },
    { &oidTable[ 30], &snmpOutGenErrs_objDesc[0] },
    { &oidTable[ 31], &snmpOutGetRequests_objDesc[0] },
    { &oidTable[ 32], &snmpOutGetNexts_objDesc[0] },
    { &oidTable[ 33], &snmpOutSetRequests_objDesc[0] },
    { &oidTable[ 34], &snmpOutGetResponses_objDesc[0] },
    { &oidTable[ 35], &snmpOutTraps_objDesc[0] },
    { &oidTable[ 36], &snmpEnableAuthenTraps_objDesc[0] },
    { &oidTable[ 37], &snmpSilentDrops_objDesc[0] },
    { &oidTable[ 38], &snmpProxyDrops_objDesc[0] },
    { &oidTable[ 39], &snmpTrapOID_objDesc[0] },
    { &oidTable[ 40], &snmpTrapEnterprise_objDesc[0] },
    { &oidTable[ 41], &snmpSetSerialNo_objDesc[0] },

    { 0 }
};


/******************************************************************************
* User Local Functions.
*/

/* %%EndUserCode   rfc1907_UserFunctions */



/****************************************************************************
*
* rfc1907Init - initialize/register rfc1907 and objects.
*
* This routine initializes the modules IDB routines.
*
* RETURNS: SNMP_OK or SNMP_ERROR
*
* ERRNO: N/A
*/

STATUS rfc1907Init
    (
    void * parm1,
    void * parm2
    )
    {
    STATUS    rc;

    /* %%BeginUserCode rfc1907Init_Prolog */
    /* %%EndUserCode   rfc1907Init_Prolog */

    rc = SNMP_OK;

    /* %%BeginUserCode rfc1907Init_Body */
    /* %%EndUserCode rfc1907Init_Body */

    /* Register the module's information with IDB+ engine */
    rc = idbModuleRegister( moduleName, &xlateTable[0] );
    
    return( rc );
    }

/******************************************************************************
*
* rfc1907Terminate - Terminate rfc1907 and objects.
*
* This routine de-initializes the IDB module functions.
*
* RETURNS: SNMP_OK or SNMP_ERROR
*
* ERRNO: N/A
*/

STATUS rfc1907Terminate
    (
    void * parm
    )
    {
    STATUS    rc;

    /* %%BeginUserCode rfc1907Terminate_Prolog */
    /* %%EndUserCode   rfc1907Terminate_Prolog */

    rc = SNMP_OK;

    /* De-register the module's information with IDB+ engine */
    idbModuleDeRegister( moduleName );

    /* %%BeginUserCode rfc1907Terminate_Epilog */
    /* %%EndUserCode   rfc1907Terminate_Epilog */

    return( rc );
    }

/******************************************************************************
*
* rfc1907ScalarHandler - handles all scalar objects.
*
* This routine handles all scalar objects for this IDB+ Module.
*
* RETURNS: SNMP_OK or SNMP_ERROR
*
* ERRNO: N/A
*/

LOCAL STATUS rfc1907ScalarHandler
    (
    idbRequest_t request,
    idb_t * idb
    )
    {
    STATUS    rc;

    /* %%BeginUserCode rfc1907ScalarHandler_Prolog */
    char *pcBuf;
    ulong_t *pulBuf;
    ulong_t ulTemp;
    /* %%EndUserCode   rfc1907Scalarhandler_Prolog */

    rc = SNMP_OK;

    /* Validate the Scalar indexSubIdCount and instance value */
    if ( idbScalarValidate( request, idb ) == SNMP_ERROR )
        return idbErrorRequestMap( request );

    switch( idb->localId )
    {
    default:
        rc = idbErrorNoSuchInstance();
        break;

    /* ================================================================= */
    case sysDescr:    /* OCTET_STRING, read-only */
        {
        /* %%BeginUserCode sysDescr_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            /* Check to make sure the next object is valid. */
            rc = idbNextScalarIndex(idb);
            if (rc != SNMP_OK)
                break;
            request = IDB_GET;

            /* FALLTHRU */
        case IDB_GET:           
             pcBuf = SNMP_Get_SysDescr((int *)&idb->valueLen);  
            if(pcBuf == NULL)
            {
                rc = SNMP_ERROR;
            }
            else
            {
                memcpy((char *)idb->pValueBuf,pcBuf,idb->valueLen);
                ((char *)idb->pValueBuf)[idb->valueLen]=0;
            }
            break;

        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNotWritable();
            break;
        }

        /* %%EndUserCode   sysDescr_Body */
        }
        break;

    /* ================================================================= */
    case sysObjectID:    /* OBJECT_IDENTIFIER, read-only */
        {
        /* %%BeginUserCode sysObjectID_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            /* Check to make sure the next object is valid. */
            rc = idbNextScalarIndex(idb);
            if (rc != SNMP_OK)
                break;
            request = IDB_GET;

            /* FALLTHRU */
        case IDB_GET:
            pulBuf = SNMP_Get_ObjectID((int *)&idb->valueLen);
            idb->valueLen = idb->valueLen * 4;
            if(pulBuf == NULL)
            {
                rc = SNMP_ERROR;
            }
            else
            {
                memcpy((char *)idb->pValueBuf,(char *)pulBuf,idb->valueLen);                
            }
            break;

        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNotWritable();
            break;
        }

        /* %%EndUserCode   sysObjectID_Body */
        }
        break;

    /* ================================================================= */
    case sysUpTime:    /* TimeTicks, read-only */
        {
        /* %%BeginUserCode sysUpTime_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            /* Check to make sure the next object is valid. */
            rc = idbNextScalarIndex(idb);
            if (rc != SNMP_OK)
                break;
            request = IDB_GET;

            /* FALLTHRU */
        case IDB_GET:
            ulTemp = SNMP_Get_SysTime();
            if(ulTemp == 0)
            {
                rc = SNMP_ERROR;
            }
            else
            {
                ulongSet(idb,ulTemp);
            }
            break;

        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNotWritable();
            break;
        }

        /* %%EndUserCode   sysUpTime_Body */
        }
        break;

    /* ================================================================= */
    case sysContact:    /* OCTET_STRING, read-write */
        {
        /* %%BeginUserCode sysContact_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            /* Check to make sure the next object is valid. */
            rc = idbNextScalarIndex(idb);
            if (rc != SNMP_OK)
                break;
            request = IDB_GET;

            /* FALLTHRU */
        case IDB_GET:            
            pcBuf = SNMP_Get_SysContact((int *)&idb->valueLen);  
            if(pcBuf == NULL)
            {
                rc = SNMP_ERROR;
            }
            else
            {
                memcpy((char *)idb->pValueBuf,pcBuf,idb->valueLen);
                ((char *)idb->pValueBuf)[idb->valueLen]=0;
            }
            break;
            
        case IDB_VALIDATE:
           
            break;
        case IDB_SET_NVM:
        case IDB_COMMIT:
            /*
             * we cannot use snmp internal processing, since 
             * there are no views as yet 
             */
            rc = SNMP_Set_SysContact(octetGet(idb), idb->valueLen );
            /*
             * Since we use Envoy packet interface, we do both VALIDATE and 
             * COMMIT during VALIDATE phase
             */ 
            break;

        }

        /* %%EndUserCode   sysContact_Body */
        }
        break;

    /* ================================================================= */
    case sysName:    /* OCTET_STRING, read-write */
        {
        /* %%BeginUserCode sysName_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            /* Check to make sure the next object is valid. */
            rc = idbNextScalarIndex(idb);
            if (rc != SNMP_OK)
                break;
            request = IDB_GET;

            /* FALLTHRU */
        case IDB_GET:
            pcBuf = SNMP_Get_SysName((int *)&idb->valueLen);  
            if(pcBuf == NULL)
            {
                rc = SNMP_ERROR;
            }
            else
            {
                memcpy((char *)idb->pValueBuf,pcBuf,idb->valueLen);
                ((char *)idb->pValueBuf)[idb->valueLen]=0;
            }
            break;
                
        case IDB_VALIDATE:
            break;

        case IDB_SET_NVM:
        case IDB_COMMIT:
            /*
             * Since we use Envoy packet interface, we do both VALIDATE and 
             * COMMIT during VALIDATE phase
             */
            rc = SNMP_Set_SysName(octetGet(idb), idb->valueLen );
            break;

        }

        /* %%EndUserCode   sysName_Body */
        }
        break;

    /* ================================================================= */
    case sysLocation:    /* OCTET_STRING, read-write */
        {
        /* %%BeginUserCode sysLocation_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            /* Check to make sure the next object is valid. */
            rc = idbNextScalarIndex(idb);
            if (rc != SNMP_OK)
                break;
            request = IDB_GET;

            /* FALLTHRU */
        case IDB_GET:
            pcBuf = SNMP_Get_SysLocation((int *)&idb->valueLen);  
            if(pcBuf == NULL)
            {
                rc = SNMP_ERROR;
            }
            else
            {
                memcpy((char *)idb->pValueBuf,pcBuf,idb->valueLen);
                ((char *)idb->pValueBuf)[idb->valueLen]=0;
            }
            break;
        case IDB_VALIDATE:
            break;
            
        case IDB_SET_NVM:
            /*
             * we cannot use snmp internal processing, since 
             * there are no views as yet 
             */
            break;
        case IDB_COMMIT:
            /*
             * Since we use Envoy packet interface, we do both VALIDATE and 
             * COMMIT during VALIDATE phase
             */ 
            rc = SNMP_Set_SysLocation(octetGet(idb), idb->valueLen );
            break;

        }

        /* %%EndUserCode   sysLocation_Body */
        }
        break;

    /* ================================================================= */
    case sysServices:    /* INTEGER, read-only */
        {
        /* %%BeginUserCode sysServices_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            /* Check to make sure the next object is valid. */
            rc = idbNextScalarIndex(idb);
            if (rc != SNMP_OK)
                break;
            request = IDB_GET;

            /* FALLTHRU */
        case IDB_GET:
            ulTemp = SNMP_Get_SysServices();
            ulongSet(idb,ulTemp);
            break;
            
        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNotWritable();
            break;

        }

        /* %%EndUserCode   sysServices_Body */
        }
        break;

    /* ================================================================= */
    case sysORLastChange:    /* TimeTicks, read-only */
        {
        /* %%BeginUserCode sysORLastChange_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            /* Check to make sure the next object is valid. */
            rc = idbNextScalarIndex(idb);
            if (rc != SNMP_OK)
                break;
            request = IDB_GET;

            /* FALLTHRU */
        case IDB_GET:
            ulTemp = SNMP_Get_SysORLastChange();
            ulongSet(idb,ulTemp);
            break;

        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNotWritable();
            break;

        }

        /* %%EndUserCode   sysORLastChange_Body */
        }
        break;

    /* ================================================================= */
    case snmpInPkts:    /* Counter32, read-only */
        {
        /* %%BeginUserCode snmpInPkts_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            /* Check to make sure the next object is valid. */
            rc = idbNextScalarIndex(idb);
            if (rc != SNMP_OK)
                break;
            request = IDB_GET;

            /* FALLTHRU */
        case IDB_GET:
            ulongSet(idb,snmp_stats.snmpInPkts);            
            break;

        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNotWritable();
            break;
        }

        /* %%EndUserCode   snmpInPkts_Body */
        }
        break;

    /* ================================================================= */
    case snmpOutPkts:    /* Counter32, read-only */
        {
        /* %%BeginUserCode snmpOutPkts_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            rc = idbErrorNoNextInstance ();
            break;

        case IDB_GET:
        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNoSuchObject ();
            break;
        }

        /* %%EndUserCode   snmpOutPkts_Body */
        }
        break;

    /* ================================================================= */
    case snmpInBadVersions:    /* Counter32, read-only */
        {
        /* %%BeginUserCode snmpInBadVersions_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            /* Check to make sure the next object is valid. */
            rc = idbNextScalarIndex(idb);
            if (rc != SNMP_OK)
                break;
            request = IDB_GET;

            /* FALLTHRU */
        case IDB_GET:
            ulongSet(idb,snmp_stats.snmpInBadVersions);   
            break;

        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNotWritable();
            break;
        }

        /* %%EndUserCode   snmpInBadVersions_Body */
        }
        break;

    /* ================================================================= */
    case snmpInBadCommunityNames:    /* Counter32, read-only */
        {
        /* %%BeginUserCode snmpInBadCommunityNames_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            /* Check to make sure the next object is valid. */
            rc = idbNextScalarIndex(idb);
            if (rc != SNMP_OK)
                break;
            request = IDB_GET;

            /* FALLTHRU */
        case IDB_GET:
            ulongSet(idb,snmp_stats.snmpInBadCommunityNames);   
            break;

        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNotWritable();
            break;
        }

        /* %%EndUserCode   snmpInBadCommunityNames_Body */
        }
        break;

    /* ================================================================= */
    case snmpInBadCommunityUses:    /* Counter32, read-only */
        {
        /* %%BeginUserCode snmpInBadCommunityUses_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            /* Check to make sure the next object is valid. */
            rc = idbNextScalarIndex(idb);
            if (rc != SNMP_OK)
                break;
            request = IDB_GET;

            /* FALLTHRU */
        case IDB_GET:
            ulongSet(idb,snmp_stats.snmpInBadCommunityUses);
            break;

        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNotWritable();
            break;
        }

        /* %%EndUserCode   snmpInBadCommunityUses_Body */
        }
        break;

    /* ================================================================= */
    case snmpInASNParseErrs:    /* Counter32, read-only */
        {
        /* %%BeginUserCode snmpInASNParseErrs_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            /* Check to make sure the next object is valid. */
            rc = idbNextScalarIndex(idb);
            if (rc != SNMP_OK)
                break;
            request = IDB_GET;

            /* FALLTHRU */
        case IDB_GET:
            ulongSet(idb,snmp_stats.snmpInASNParseErrs);
            break;

        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNotWritable();
            break;
        }

        /* %%EndUserCode   snmpInASNParseErrs_Body */
        }
        break;

    /* ================================================================= */
    case snmpInTooBigs:    /* Counter32, read-only */
        {
        /* %%BeginUserCode snmpInTooBigs_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            rc = idbErrorNoNextInstance ();
            break;

        case IDB_GET:
        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNoSuchObject ();
            break;
        }

        /* %%EndUserCode   snmpInTooBigs_Body */
        }
        break;

    /* ================================================================= */
    case snmpInNoSuchNames:    /* Counter32, read-only */
        {
        /* %%BeginUserCode snmpInNoSuchNames_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            rc = idbErrorNoNextInstance ();
            break;
        case IDB_GET:
        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNoSuchObject ();
            break;
        }

        /* %%EndUserCode   snmpInNoSuchNames_Body */
        }
        break;

    /* ================================================================= */
    case snmpInBadValues:    /* Counter32, read-only */
        {
        /* %%BeginUserCode snmpInBadValues_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            rc = idbErrorNoNextInstance ();
            break;
        case IDB_GET:
        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNoSuchObject ();
            break;
        }

        /* %%EndUserCode   snmpInBadValues_Body */
        }
        break;

    /* ================================================================= */
    case snmpInReadOnlys:    /* Counter32, read-only */
        {
        /* %%BeginUserCode snmpInReadOnlys_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            rc = idbErrorNoNextInstance ();
            break;
        case IDB_GET:
        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNoSuchObject ();
            break;
        }

        /* %%EndUserCode   snmpInReadOnlys_Body */
        }
        break;

    /* ================================================================= */
    case snmpInGenErrs:    /* Counter32, read-only */
        {
        /* %%BeginUserCode snmpInGenErrs_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            rc = idbErrorNoNextInstance ();
            break;
        case IDB_GET:
        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNoSuchObject ();
            break;
        }

        /* %%EndUserCode   snmpInGenErrs_Body */
        }
        break;

    /* ================================================================= */
    case snmpInTotalReqVars:    /* Counter32, read-only */
        {
        /* %%BeginUserCode snmpInTotalReqVars_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            rc = idbErrorNoNextInstance ();
            break;
        case IDB_GET:
        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNoSuchObject ();
            break;
        }

        /* %%EndUserCode   snmpInTotalReqVars_Body */
        }
        break;

    /* ================================================================= */
    case snmpInTotalSetVars:    /* Counter32, read-only */
        {
        /* %%BeginUserCode snmpInTotalSetVars_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            rc = idbErrorNoNextInstance ();
            break;
        case IDB_GET:
        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNoSuchObject ();
            break;
        }

        /* %%EndUserCode   snmpInTotalSetVars_Body */
        }
        break;

    /* ================================================================= */
    case snmpInGetRequests:    /* Counter32, read-only */
        {
        /* %%BeginUserCode snmpInGetRequests_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            rc = idbErrorNoNextInstance ();
            break;
        case IDB_GET:
        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNoSuchObject ();
            break;
        }

        /* %%EndUserCode   snmpInGetRequests_Body */
        }
        break;

    /* ================================================================= */
    case snmpInGetNexts:    /* Counter32, read-only */
        {
        /* %%BeginUserCode snmpInGetNexts_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            rc = idbErrorNoNextInstance ();
            break;
        case IDB_GET:
        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNoSuchObject ();
            break;
        }

        /* %%EndUserCode   snmpInGetNexts_Body */
        }
        break;

    /* ================================================================= */
    case snmpInSetRequests:    /* Counter32, read-only */
        {
        /* %%BeginUserCode snmpInSetRequests_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            rc = idbErrorNoNextInstance ();
            break;
        case IDB_GET:
        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNoSuchObject ();
            break;
        }

        /* %%EndUserCode   snmpInSetRequests_Body */
        }
        break;

    /* ================================================================= */
    case snmpInGetResponses:    /* Counter32, read-only */
        {
        /* %%BeginUserCode snmpInGetResponses_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            rc = idbErrorNoNextInstance ();
            break;
        case IDB_GET:
        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNoSuchObject ();
            break;
        }

        /* %%EndUserCode   snmpInGetResponses_Body */
        }
        break;

    /* ================================================================= */
    case snmpInTraps:    /* Counter32, read-only */
        {
        /* %%BeginUserCode snmpInTraps_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            rc = idbErrorNoNextInstance ();
            break;
        case IDB_GET:
        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNoSuchObject ();
            break;
        }

        /* %%EndUserCode   snmpInTraps_Body */
        }
        break;

    /* ================================================================= */
    case snmpOutTooBigs:    /* Counter32, read-only */
        {
        /* %%BeginUserCode snmpOutTooBigs_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            rc = idbErrorNoNextInstance ();
            break;
        case IDB_GET:
        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNoSuchObject ();
            break;
        }

        /* %%EndUserCode   snmpOutTooBigs_Body */
        }
        break;

    /* ================================================================= */
    case snmpOutNoSuchNames:    /* Counter32, read-only */
        {
        /* %%BeginUserCode snmpOutNoSuchNames_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            rc = idbErrorNoNextInstance ();
            break;
        case IDB_GET:
        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNoSuchObject ();
            break;
        }

        /* %%EndUserCode   snmpOutNoSuchNames_Body */
        }
        break;

    /* ================================================================= */
    case snmpOutBadValues:    /* Counter32, read-only */
        {
        /* %%BeginUserCode snmpOutBadValues_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            rc = idbErrorNoNextInstance ();
            break;
        case IDB_GET:
        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNoSuchObject ();
            break;
        }

        /* %%EndUserCode   snmpOutBadValues_Body */
        }
        break;

    /* ================================================================= */
    case snmpOutGenErrs:    /* Counter32, read-only */
        {
        /* %%BeginUserCode snmpOutGenErrs_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            rc = idbErrorNoNextInstance ();
            break;
        case IDB_GET:
        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNoSuchObject ();
            break;
        }

        /* %%EndUserCode   snmpOutGenErrs_Body */
        }
        break;

    /* ================================================================= */
    case snmpOutGetRequests:    /* Counter32, read-only */
        {
        /* %%BeginUserCode snmpOutGetRequests_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            rc = idbErrorNoNextInstance ();
            break;
        case IDB_GET:
        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNoSuchObject ();
            break;
        }

        /* %%EndUserCode   snmpOutGetRequests_Body */
        }
        break;

    /* ================================================================= */
    case snmpOutGetNexts:    /* Counter32, read-only */
        {
        /* %%BeginUserCode snmpOutGetNexts_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            rc = idbErrorNoNextInstance ();
            break;
        case IDB_GET:
        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNoSuchObject ();
            break;
        }

        /* %%EndUserCode   snmpOutGetNexts_Body */
        }
        break;

    /* ================================================================= */
    case snmpOutSetRequests:    /* Counter32, read-only */
        {
        /* %%BeginUserCode snmpOutSetRequests_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            rc = idbErrorNoNextInstance ();
            break;
        case IDB_GET:
        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNoSuchObject ();
            break;
        }

        /* %%EndUserCode   snmpOutSetRequests_Body */
        }
        break;

    /* ================================================================= */
    case snmpOutGetResponses:    /* Counter32, read-only */
        {
        /* %%BeginUserCode snmpOutGetResponses_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            rc = idbErrorNoNextInstance ();
            break;
        case IDB_GET:
        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNoSuchObject ();
            break;
        }

        /* %%EndUserCode   snmpOutGetResponses_Body */
        }
        break;

    /* ================================================================= */
    case snmpOutTraps:    /* Counter32, read-only */
        {
        /* %%BeginUserCode snmpOutTraps_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            rc = idbErrorNoNextInstance ();
            break;
        case IDB_GET:
        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNoSuchObject ();
            break;
        }

        /* %%EndUserCode   snmpOutTraps_Body */
        }
        break;

    /* ================================================================= */
    /*
    * EsnmpEnableAuthenTraps_enabled 1
    * EsnmpEnableAuthenTraps_disabled 2
    */
    case snmpEnableAuthenTraps:    /* INTEGER, read-write */
        {
        /* %%BeginUserCode snmpEnableAuthenTraps_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            /* Check to make sure the next object is valid. */
            rc = idbNextScalarIndex(idb);
            if (rc != SNMP_OK)
                break;
            request = IDB_GET;

            /* FALLTHRU */
        case IDB_GET:
            ulTemp =  (ulong_t)SNMP_Get_AuthenTraps();
            if (ulTemp != 1)
            {
                ulTemp = 2;
            }
            ulongSet(idb,ulTemp);            
            break;

        case IDB_VALIDATE:
            if ((ulongGet(idb) < 1) || (ulongGet(idb) > 2))
            {
                rc = SNMP_ERROR;
            }

            break;
        case IDB_SET_NVM:
            /*
             * we cannot use snmp internal processing, since 
             * there are no views as yet 
             */
            
            break;
        case IDB_COMMIT:
            /*
             * Since we use Envoy packet interface, we do both VALIDATE and 
             * COMMIT during VALIDATE phase
             */ 
            rc = SNMP_Set_AuthenTraps(ulongGet(idb));
            break;
        }

        /* %%EndUserCode   snmpEnableAuthenTraps_Body */
        }
        break;

    /* ================================================================= */
    case snmpSilentDrops:    /* Counter32, read-only */
        {
        /* %%BeginUserCode snmpSilentDrops_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            /* Check to make sure the next object is valid. */
            rc = idbNextScalarIndex(idb);
            if (rc != SNMP_OK)
                break;
            request = IDB_GET;

            /* FALLTHRU */
        case IDB_GET:
            ulongSet(idb,snmp_stats.snmpSilentDrops);
            break;

        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNotWritable();
            break;
        }

        /* %%EndUserCode   snmpSilentDrops_Body */
        }
        break;

    /* ================================================================= */
    case snmpProxyDrops:    /* Counter32, read-only */
        {
        /* %%BeginUserCode snmpProxyDrops_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            /* Check to make sure the next object is valid. */
            rc = idbNextScalarIndex(idb);
            if (rc != SNMP_OK)
                break;
            request = IDB_GET;

            /* FALLTHRU */
        case IDB_GET:
            ulongSet(idb,snmp_stats.snmpProxyDrops);
            break;

        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNotWritable();
            break;
        }

        /* %%EndUserCode   snmpProxyDrops_Body */
        }
        break;

    /* ================================================================= */
    case snmpTrapOID:    /* OBJECT_IDENTIFIER, accessible-for-notify */
        {
        /* %%BeginUserCode snmpTrapOID_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            rc = idbErrorNoNextInstance ();
            break;
        case IDB_GET:
        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNoSuchObject ();
            break;
        }

        /* %%EndUserCode   snmpTrapOID_Body */
        }
        break;

    /* ================================================================= */
    case snmpTrapEnterprise:    /* OBJECT_IDENTIFIER, accessible-for-notify */
        {
        /* %%BeginUserCode snmpTrapEnterprise_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            rc = idbErrorNoNextInstance ();
            break;
        case IDB_GET:
        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNoSuchObject ();
            break;
        }

        /* %%EndUserCode   snmpTrapEnterprise_Body */
        }
        break;

    /* ================================================================= */
    case snmpSetSerialNo:    /* INTEGER, read-write */
        {
        /* %%BeginUserCode snmpSetSerialNo_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            /* Check to make sure the next object is valid. */
            rc = idbNextScalarIndex(idb);
            if (rc != SNMP_OK)
                break;
            request = IDB_GET;

            /* FALLTHRU */
        case IDB_GET:
            ulTemp = SNMP_SetSerialNoGetValue();
            ulongSet(idb, ulTemp);
            break;
            
        case IDB_VALIDATE:
            break;

        case IDB_SET_NVM:
        case IDB_COMMIT:
            /*
             * Since we use Envoy packet interface, we do both VALIDATE and 
             * COMMIT during VALIDATE phase
             */ 
            ulongGet(idb);
            SNMP_SetSerialNoSetValue(ulongGet(idb));
            break;
        }

        /* %%EndUserCode   snmpSetSerialNo_Body */
        }
        break;

    }

    /* %%BeginUserCode rfc1907Scalar_Epilog */
    /* %%EndUserCode   rfc1907Scalar_Epilog */

    return( rc );
    }

/******************************************************************************
*
* sysOREntryTableHandler - handles table objects.
*
* This routine handles all objects for this table.
*
* RETURNS: SNMP_OK or SNMP_ERROR
*
* ERRNO: N/A
*/

LOCAL STATUS sysOREntryTableHandler
    (
    idbRequest_t request,
    idb_t * idb
    )
    {
    STATUS    rc;

    /* %%BeginUserCode sysOREntryTableHandler_Prolog */
    /* %%EndUserCode   sysOREntryTablehandler_Prolog */

    rc = SNMP_OK;

    switch( idb->localId )
    {
    default:
        rc = idbErrorNoSuchInstance();
        break;

    /* ================================================================= */
    case sysORID:    /* OBJECT IDENTIFIER, read-only */
        {
        /* %%BeginUserCode sysORID_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            rc = SNMP_SysOREntryGetNext(idb);
            break;
            
        case IDB_GET:
            rc = SNMP_SysOREntryGet(idb);
            break;

        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNotWritable();
            break;
        }

        /* %%EndUserCode   sysORID_Body */
        }
        break;

    /* ================================================================= */
    case sysORDescr:    /* OCTET STRING, read-only */
        {
        /* %%BeginUserCode sysORDescr_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            rc = SNMP_SysOREntryGetNext(idb);
            break;
            
        case IDB_GET:
            rc = SNMP_SysOREntryGet(idb);
            break;

        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNotWritable();
            break;
        }

        /* %%EndUserCode   sysORDescr_Body */
        }
        break;

    /* ================================================================= */
    case sysORUpTime:    /* TimeTicks, read-only */
        {
        /* %%BeginUserCode sysORUpTime_Body */

        switch ( request )
        {
        case IDB_GET_NEXT:
            rc = SNMP_SysOREntryGetNext(idb);
            break;
            
        case IDB_GET:
            rc = SNMP_SysOREntryGet(idb);
            break;

        case IDB_SET_NVM:
        case IDB_VALIDATE:
        case IDB_COMMIT:
            rc = idbErrorNotWritable();
            break;
        }

        /* %%EndUserCode   sysORUpTime_Body */
        }
        break;

    }

    /* %%BeginUserCode sysOREntryTable_Epilog */
    if (SNMP_OK != rc)
        rc = idbErrorRequestMap( request );   
    /* %%EndUserCode   sysOREntryTable_Epilog */

    return( rc );
    }

